package com.musicalevents.dao.impl;

import java.util.List;

import org.hibernate.Query;
import org.springframework.dao.DataAccessException;

import com.musicalevents.dao.BandDAO;
import com.musicalevents.entity.Band;


@SuppressWarnings("unchecked")
public class BandDAOImpl extends GenericDAOImpl<Band, Integer> implements BandDAO {
	
	public BandDAOImpl(Class<Band> type) {
		super(type);
	}

	public List<Band> getAllBandsByGenre(String genre) throws DataAccessException {
		Query query = getSession().createQuery("FROM Band WHERE genre = :genre");
		query.setParameter("genre", genre);
		List<Band> bands = query.list();
		return (bands);
	}
}
